﻿@model  Prosiak.Areas.Books.IndexViewModel

@{
    ViewBag.Title = "Index";
}



<h2>Index</h2>
    @Html.ActionLink("Create New", "Create")
    <br />
    @using(Ajax.BeginForm( 
        actionName: null, 
        routeValues: null,
        ajaxOptions: new AjaxOptions{
                        HttpMethod = "get",
                        InsertionMode=InsertionMode.Replace,
                        UpdateTargetId="listOfBooks"},
        htmlAttributes: new {@class = "form-inline", role = "form"}))
    {
        <div class="form-group">
            <input type="search" class="form-control input-sm" name="searchString" placeholder="Author or Title" data-prosiak-autocomplete="@Url.Action("Autocomplete")" />
             @Html.Label("Category: ", new { @class = "control-label" })
            <select class="form-control input-sm" id="BookCategories" name="category">
                <option>All</option>
                @foreach (SelectListItem item in Model.Categories)
                {
                    <option>@item.Text</option> 
                }
            </select>
            @Html.Label("Number of results: ", new { @class = "control-label" })
            <select class="form-control input-sm" id="ResultsPerPageOptions" name="resultsPerPage">
                @foreach (SelectListItem item in Model.ResultsPerPageOptions)
                {
                    <option>@item.Text</option> 
                }
            </select>
           <input type="submit" value="Filter" class="btn btn-default btn-sm" />
        </div>
    }
   


@Html.Partial("_Books", Model)